using System.Collections.Generic;

namespace SqlRunner.uiStatus
{
    /// <summary>
    /// This is just a collection of GroupControls that helps to
    /// execute the UpdateStatus method in a quick fashion.
    /// </summary>
    public class Groups<T>
    {

        #region Private Instances

        private readonly List<GroupControls<T>> GroupList = new List<GroupControls<T>>();

        #endregion
        #region Public Methods

        public void AddGroup(GroupControls<T> group)
        {
            if ( GroupList.IndexOf(group) == -1 )
            {
                GroupList.Add(group);
            }
        }

        public void UpdateStatus(T status)
        {
            foreach (GroupControls<T> group in GroupList)
            {
                group.UpdateProperty(status);
            }
        }

        #endregion

    }
}